﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;
using System.Globalization;
using System.Windows.Art;

namespace System.Windows.Elements
{
    [ValueConversion(typeof(Color), typeof(Brush))]
    class ColorToBrushConverter : IValueConverter
    {
        public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            if (value is IColor) return new SolidColorBrush(((IColor)value).ToColor());
            else if (value is Color) return new SolidColorBrush((Color)value);
            else return null;
        }

        public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
